<?php


class rss_export {



  function exportRss($table, $titleField, $textField, $urlField, $where = "", $orderby= "", $limit= "") {  
        
        
        header("Content-Type: application/xml; charset=ISO-8859-1"); 
        
        //$dataFeed = SqlQuery("SELECT * FROM snapol_rss WHERE filename = '$fileName'");
        
        /*$rssTable = $dataFeed['table'][0];
        $rssTitleField = $dataFeed['titel_field'][0];
        $rssLinkField = $dataFeed['url_field'][0]; 
        $rssTextField = $dataFeed['text_field'][0];  */
        


echo '<?xml version="1.0" encoding="ISO-8859-1" ?> 
                 <rss version="2.0"> 
                        <channel> 
                            <title>'.$table.'</title> 
                            <link></link> 
                            <description></description> 
                            <language></language> 
                            <image> 
                                <title></title> 
                                <url></url> 
                                <link></link> 
                                <width></width> 
                                <height></height> 
                            </image>'; 










        //$data = SqlQuery("SELECT * FROM $rssTable");
        $data = new data($table, $where, $orderby, $limit);
        
        do {
            
                $item = "<item>\n<title>".$data->data[$titleField]."</title>\n".
                   "<link>http://localhost".$data->data[$urlField]."</link>\n".
                   "<description><![CDATA[".$data->data[$textField]."]]></description>\n". 
                   "</item>\n"; 
            
                echo $item;
            
            
        } while($data->nextRow());
        
        //for ($n = 0; $n < sizeof($data['id']); $n++) {
            //echo $data[$rssTitleField][$n]."<br>";
       // }

        
        
    }
}




  
?>
